<?php
/**
 * Bit Operators
 */

$a = 10; //10-1010
$c = 4;//4-0100
$b = $a & $c;
$a &= $c;

echo '$a = ' , $a , "\n";
echo '$b = ' , $b , "\n";

$a = 10; //10-1010
$c = 4;//4-0100
$b = $a | $c;
$a |= $c;

echo '$a = ' , $a , "\n";
echo '$b = ' , $b , "\n";

$a = 10; //10-1010
$c = 15;//15-1111
$b = $a ^ $c;
$a ^= $c;

echo '$a = ' , $a , "\n";
echo '$b = ' , $b , "\n";


$a = 10; //10-0000 1010
$c = 2;
$b = $a << $c;
$a <<= $c;

echo '$a = ' , $a , "\n";
echo '$b = ' , $b , "\n";

$a = 10; //10-0000 1010
$c = 2;
$b = $a >> $c;
$a >>= $c;

echo '$a = ' , $a , "\n";
echo '$b = ' , $b , "\n";


for ($a = -11; $a < 11; $a++) {
	$b = ~$a;
	echo "~\$a($a) = " , $b , "\n";
}

